<template>
    <div class="add-logistics">
        <el-form-item label="物流支持" required>
            <el-checkbox v-model="value.is_express" :false-label="0" :true-label="1">快递发货</el-checkbox>
            <el-checkbox v-model="value.is_selffetch" :false-label="0" :true-label="1">上门自提</el-checkbox>
        </el-form-item>
        <el-form-item label="运费设置" required>
            <el-radio-group v-model="value.express_type">
                <el-radio :label="1">包邮</el-radio>
                <el-radio :label="2">统一运费</el-radio>
                <el-radio :label="3">运费模板</el-radio>
            </el-radio-group>
        </el-form-item>
        <el-form-item v-if="value.express_type==2" prop="express_money">
            <el-input v-model="value.express_money">
                <template slot="append">元</template>
            </el-input>
        </el-form-item>
        <el-form-item v-if="value.express_type==3">
            <el-select v-model="value.express_template_id" placeholder="请选择运费模板" prop="express_template_id">
                 <el-option
                    v-for="item in freightList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                ></el-option>
            </el-select>
        </el-form-item>
    </div>
</template>

<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";

@Component
export default class AddLogistics extends Vue {
    @Prop() value: any;
    @Prop({ default: () => ({}) }) lists: any
    get freightList() {
        return this.lists.freight_list || []
    }
}
</script>

